package com.kit.advert.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kit.advert.domain.AdvertMaterial;
import com.kit.advert.mapper.AdvertMaterialMapper;
import com.kit.advert.service.IAdvertMaterialService;
import com.kit.common.core.page.TableDataInfo;
import com.kit.common.utils.PageUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * 广告素材service接口实现类
 *
 * @author zhangxin
 * @date 2024-05-18 21:28
 */
@Service
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class AdvertMaterialServiceImpl extends ServiceImpl<AdvertMaterialMapper, AdvertMaterial> implements IAdvertMaterialService {

    @Override
    public TableDataInfo<AdvertMaterial> selectPage(AdvertMaterial advertMaterial) {
        QueryWrapper<AdvertMaterial> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(Objects.nonNull(advertMaterial.getOrderId()), "order_id", advertMaterial.getAdvertId());
        return PageUtils.buildDataInfo(page(PageUtils.buildPage(), queryWrapper));
    }
}
